<template>
  <div>
    <ZgEdit
      ref="dialog"
      :columns="columns"
      :formulas="formulas"
      :inputClick="inputClick"
      validUrl=""
      saveUrl=""
      :view="view"
      @ok="$emit('ok')">
    </ZgEdit>
  </div>
</template>
<script>
export default {
  data () {
    return {
      view: {
        width: '60%',
        top: '3%',
        title: '新增'
      },
      columns: [
        {
          name: '统一社会信用编码',
          code: 'code',
          divider: '基础信息',
          compType: '单行文本',
          isNeed: true,
          offset: 0,
          span: 18,
          defaultVal: '911407291130629881',
          regex: '',
          errorMsg: '',
          extra: {
            placeholder: '请输入',
            suffix: 'icon',
            icon: ''
          }
        },
        { name: '公司名称', code: 'companyName', compType: '单行文本', isNeed: true, offset: 0, span: 12, defaultVal: '本钢板材股份有限公司' },
        { name: '所在地', code: 'address', compType: '单行文本', isNeed: true, offset: 0, span: 12, defaultVal: '' },
        { name: '营业开始日期', code: 'startDate', compType: '日期', isNeed: true, offset: 0, span: 12, defaultVal: '' },
        { name: '营业结束日期', code: 'endDate', compType: '日期', isNeed: true, offset: 0, span: 12, defaultVal: '' },
        { name: '注册资本', code: 'score', compType: '浮点数', isNeed: true, offset: 0, span: 24, defaultVal: 0, unit: '万元' },
        { name: '公司性质', code: 'orgType', compType: '下拉选择', isNeed: true, offset: 0, span: 12, defaultVal: '', extra: { 下拉选项: [{ value: '1', label: '1' }, { value: '2', label: '2' }] } },
        { name: '机构类型', code: 'orgType', compType: '下拉选择', isNeed: true, offset: 0, span: 12, defaultVal: '', extra: { 下拉选项: [{ value: '1', label: '1' }, { value: '2', label: '2' }] } },
        { name: '所属集团', code: 'country', compType: '下拉选择', isNeed: true, offset: 0, span: 12, defaultVal: '', extra: { 下拉选项: [{ value: '1', label: '1' }, { value: '2', label: '2' }] } },
        { name: '营业执照/统一社会信用代码证书', code: 'head', compType: '多图', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { note: '支持文件格式: .jpg、.png' } },
        { name: '金融行业资质证明', code: 'head', compType: '多图', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { note: '支持文件格式: .jpg、.png 《金融许可证》、《小额贷款公司经营许可证》、《经营保险业务许可证》、《支付业务许可证》、《经营保险经纪业务许可证》、《经营保险代理业务许可证》、《经营证券朋货业务许可证》等' } },
        { name: '法定代表人身份证', code: 'head', divider: '法定代表人信息', compType: '多图', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { note: '上传身份证正反面照片，支持文件格式: .jpg、.png' } },
        { name: '法定代表人姓名', code: 'name1', compType: '单行文本', isNeed: true, offset: 0, span: 12, defaultVal: '', extra: { placeholder: '请输入法定代表人姓名' } },
        { name: '法人身份证号码', code: 'number', compType: '单行文本', isNeed: true, offset: 0, span: 12, defaultVal: '', extra: { placeholder: '请输入法定代表人身份证号码' } },
        { name: '是否法定代表人本人申请', code: 'political', compType: '单选', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { 选项: [{ value: '1', label: '是，我是本人' }, { value: '2', label: '否，我是代理人' }] } },
        { name: '姓名', code: 'name2', divider: '代理人信息', compType: '单行文本', isNeed: true, offset: 0, span: 12, defaultVal: '', extra: { placeholder: '请输入代理人姓名' } },
        { name: '代理人身份证', code: 'head', compType: '多图', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { note: '上传身份证正反面照片，支持文件格式: .jpg、.png' } },
        { name: '授权委托书', code: 'head', compType: '多图', isNeed: true, offset: 0, span: 24, defaultVal: '', extra: { note: '支持文件格式: .jpg、.png、.pdf,点击下载委托书模版' } },
        { name: '联系电话', code: 'phone', compType: '单行文本', isNeed: true, offset: 0, span: 12, defaultVal: '请输入联系电话' },
        { name: '手机验证码', code: 'phone', compType: '单行文本', isNeed: true, offset: 0, span: 12, defaultVal: '请输入验证码' },
        { name: '用户名', code: 'name4', compType: '文本', isNeed: false, offset: 0, span: 12, defaultVal: '系统自动生成' },
        { name: '密码', code: 'password', compType: '文本', isNeed: false, offset: 0, span: 12, defaultVal: '短信发送至联系人手机，请注意查收' }
      ],
      formulas: []
    }
  },
  methods: {
    open (json, pageType) {
      if (pageType === 'edit') {
        this.$refs.dialog.open()
        this.view.title = '编辑'
      } else {
        this.$refs.dialog.open()
        this.view.title = '新增'
      }
    },
    inputClick (t) {
      alert(JSON.stringify(t))
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
